
package ch.hearc.coursJava.kitBase.tab2D;

import ch.hearc.coursJava.kitBase.tools.TabTools;

public class UseTableau2D
	{

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	public static void main(String[] args)
		{
		//hello();
		//addition();
		triangulaire();
		heterogene();
		tabClone();
		}

	public static void hello()
		{
		int n = 3;
		int m = 2;

		double[][] tab1 = TabTools.creerManuel(n, m);
		double[][] tab2 = TabTools.creer(m, n);

		fill(tab1);
		fill(tab2);

		TabTools.afficher(tab1);
		TabTools.afficher(tab2);
		}

	public static void addition()
		{
		double[][] tab1 = { { 1, 2 }, { 3, 4 } };
		double[][] tab2 = { { 10, 20 }, { 30, 40 } };

		double[][] tableauAddition = TabTools.additionner(tab1, tab2);

		TabTools.afficher(tableauAddition);
		}

	/**
	 * <pre>
	 * 11 12 13
	 * 21 22 23
	 * 31 32 33
	 * </pre>
	 */
	public static void fill(double[][] tab)
		{
		for(int i = 1; i <= tab.length; i++)
			{
			for(int j = 1; j <= tab[i - 1].length; j++)
				{
				tab[i - 1][j - 1] = 10 * i + j;
				}
			}
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	private static void heterogene()
		{
		int[] tabNbColonneParLigne = new int[] { 5, 4, 3, 2, 1 };
		double[][] tabHeterogene = TabTools.creer(tabNbColonneParLigne);

		fill(tabHeterogene);
		TabTools.afficher(tabHeterogene);
		}

	private static void triangulaire()
		{
		int n = 5;
		double[][] tabTriangulaire = TabTools.creer(n);

		fill(tabTriangulaire);
		TabTools.afficher(tabTriangulaire);
		}

	private static void tabClone()
		{
		int n = 5;
		int m = 6;

		double[][] matrixA = TabTools.creer(n, m);
		double[][] matrixB = TabTools.cloner(matrixA);

		}
	}
